package com.gamificationlibrary.gamificationlibrary.model;
import java.io.Serializable;
import java.util.ArrayList;

import com.gamificationlibrary.gamificationlibrary.badge.Badge;
import com.gamificationlibrary.gamificationlibrary.badge.BadgeSystem;
import com.gamificationlibrary.gamificationlibrary.levels.Level;


public abstract class Player implements Serializable{
	
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 7104175545982448759L;
	private Score scoreTotal;
	private Level level;
	private int rank;
	private ArrayList<Score> temporalScore;
	private ArrayList<Score> geographicalScore;
	//private HashMap<Integer, BadgeState> badges;
	private BadgeSystem badges;
	
	public Player(){
		
		scoreTotal=new Score();
		level=null;
		rank=0;
		temporalScore=new ArrayList<Score>();
		//badges=new HashMap<Integer, BadgeState>();
	}
	
	

	public void setTemporalScore(ArrayList<Score> temporalScore) {
		this.temporalScore = temporalScore;
	}

	public void setGeographicalScore(ArrayList<Score> geoScore) {
		this.geographicalScore = geoScore;
	}
	
	public Score getScoreTotal() {
		return scoreTotal;
	}

	public void setScoreTotal(Score total) {
		this.scoreTotal = total;
	}
	
	
	
	public abstract int getStraightDayscontrib();
	
	public abstract int getnumberofTimeTaskPerformed();


	
	public Score getTemporalScore(int numDays)
	{
		// TODO Auto-generated method stub
				for(int i=0;i<temporalScore.size();i++)
				{
					if( (temporalScore.get(i)).getNumDays()==numDays)
					{
						return temporalScore.get(i);
					}
				}
				
				return null;
	}
	
	public Score getGeographicalScore(Area area)
	{
		for(int i=0;i<geographicalScore.size();i++)
		{
			if( (geographicalScore.get(i)).getArea().getName().equals(area.getName()))
			{
				return geographicalScore.get(i);
			}
		}
		
		return null;
	}
	
	public abstract Score getGeoTemporalScore(int numDays, Object area);	
	

	
	public abstract String getIdentification();
	
    
   /* public void initBadges(BadgeSystem b)
    {
    	for(int i=0;i<b.getBadges().size();i++)
    	{
    		badges.put(b.getBadges().get(i).getId(), b.getBadges().get(i).getCurrentState());
    	}
    }
*/
	public Level getLevel() {
		return level;
	}

	public void setLevel(Level level) {
		this.level = level;
	}

	public int getRank() {
		return rank;
	}

	public void setRank(int rank) {
		this.rank = rank;
	}

	public BadgeSystem getBadges() {
		return badges;
	}

	public void setBadges(BadgeSystem badges_won) {
		this.badges = badges_won;
	}
     

}
